package com.soku.wangheng.txtcopy.ui;

import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;

public class MainFrame extends JFrame {
	
	private static int BUTTON_WIDTH = 70;
	private static int BUTTON_HEIGHT = 25;
	private static int FILE_FIELD_WIDTH = 150;
	private static int FILE_FIELD_HEIGHT = 25;
	private static int EXTEN_FIELD_WIDTH = 50;
	private static int EXTEN_FIELD_HEIGHT = 25;
	
	public static MainFrame I = new MainFrame();
	
	private static final long serialVersionUID = 5180432589158414005L;
	
	private JTextField fromDirTextField;
	private JTextField toDirTextField;
	private JButton chooceFromDirButton;
	private JButton chooceToDirButton;
	
	private JTextField fromExtenTextField;
	private JTextField toExtenTextField;
	private JProgressBar progressBar;
	private JButton executeButton;
	private JLabel fromLabel;
	private JLabel toLabel;
	
	private  MainFrame() {
		super("小幸的文件扩展名转换器");
		//初始化主窗体
		this.setLocationRelativeTo(null);
		this.setResizable(false);
		this.setSize(400, 200);
		this.setLayout(null);
		
		//初始化文件选择模块
		//from
		fromDirTextField = new JTextField();
		fromDirTextField.setSize(FILE_FIELD_WIDTH, FILE_FIELD_HEIGHT);
		fromDirTextField.setLocation(25, 15);
		chooceFromDirButton = new JButton();
		chooceFromDirButton.setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
		chooceFromDirButton.setLocation(180, 15);
		chooceFromDirButton.setText("选择目录");
		fromLabel = new JLabel();
		fromLabel.setText("扩展名");
		fromLabel.setSize(50, 25);
		fromLabel.setLocation(260, 15);
		fromLabel.setVisible(true);
		fromExtenTextField =  new JTextField();
		fromExtenTextField.setSize(EXTEN_FIELD_WIDTH, EXTEN_FIELD_HEIGHT);
		fromExtenTextField.setLocation(310, 15);
		
		//to
		toDirTextField = new JTextField();
		toDirTextField.setSize(FILE_FIELD_WIDTH, FILE_FIELD_HEIGHT);
		toDirTextField.setLocation(25, 60);
		chooceToDirButton = new JButton();
		chooceToDirButton.setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
		chooceToDirButton.setLocation(180, 60);
		chooceToDirButton.setText("选择目录");
		toLabel = new JLabel();
		toLabel.setText("扩展名");
		toLabel.setSize(50, 25);
		toLabel.setLocation(260, 60);
		toLabel.setVisible(true);
		toExtenTextField =  new JTextField();
		toExtenTextField.setSize(EXTEN_FIELD_WIDTH, EXTEN_FIELD_HEIGHT);
		toExtenTextField.setLocation(310, 60);
		
		
		//初始化目标文件选择器
		
		//初始化两个label
		//初始化进度条
		//执行按钮
		executeButton = new JButton();
		executeButton.setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
		executeButton.setLocation(180, 60);
		
		//add
		this.add(fromDirTextField);
		this.add(chooceFromDirButton);
		this.add(fromLabel);
		this.add(fromExtenTextField);
		this.add(toDirTextField);
		this.add(chooceToDirButton);
		this.add(toLabel);
		this.add(toExtenTextField);
	}
	
	public void showWindow(){
		this.setVisible(true);
	}
}
